//
//need to be sure and override the team assign
//code for people joining and replace it with our own.
//even if we only use it of testing purposes
//

class BG3Game extends UTTeamGame
	config(Game);

var array<BG3Objective> ObjectiveNodes;

simulated function PostBeginPlay()
{
    local BG3Objective o;
    super.PostBeginPlay();

    //getting all the nodes in the world to save time later when computing scores

    foreach AllActors(class'BG3Objective', o)
    {
        if(o != none) //probably not needed, but want to be safe
        {
            ObjectiveNodes.AddItem(o);
        }
    }
    `log(ObjectiveNodes.Length);

}


//overwritten, return game type
static event class<GameInfo> SetGameType(string Mapname, string Options, string Portal)
{
	return class'BG3Game';
}

//overwritten, add default inventory items based on the class the player selected (default: rifleman)
function AddDefaultInventory( pawn PlayerPawn )
{
	local int i;
	local array< class<UTWeapon> > itemstogive;
	local BG3Pawn pawn;
	local class<BG3FamilyInfo> finfo;

	if(BG3Pawn(PlayerPawn) != none)
	{
		pawn = BG3Pawn(PlayerPawn);
		if(class<BG3FamilyInfo>(pawn.CurrCharClassInfo) != none)
		{
			finfo = class<BG3FamilyInfo>(pawn.CurrCharClassInfo);
			itemstogive = finfo.default.startingitems;

			for (i=0; i<itemstogive.Length; i++)
			// Ensure we don't give duplicate items
			if (PlayerPawn.FindInventoryType( itemstogive[i] ) == None)
			{
				// Only activate the first weapon
				PlayerPawn.CreateInventory(itemstogive[i], (i > 0));
			}
		}
	}

	PlayerPawn.AddDefaultInventory();
}

//overriding to disable Scaleform HUD and force classicHUD
function GenericPlayerInitialization(Controller C)
{
	bUseClassicHUD = true;
	super.GenericPlayerInitialization(C);
}

defaultproperties
{
	//bRestartLevel = true
	//bUseClassicHUD = true
	bDelayedStart = false
	bWaitingToStartMatch = false

	PlayerControllerClass = class'BG3Game.BG3PlayerController'
	DefaultPawnClass = class'BG3Game.BG3Pawn'
	HUDType = class'BG3Game.BG3HUD'
	PlayerReplicationInfoClass = class'BG3PlayerReplicationInfo'

	//testing inventory
	DefaultInventory[1] = class'UTWeap_ShockRifle'
}